<?php
/**
 * @orm tablename article_images
 */
class ArticleImage {
	/**
	 * @orm plugin DomArImage({autoRename=1r})
	 * @orm listener afterAdd afterAddImage
	 */
	public $image;
	/**
	 * @orm plugin DomArImage({autoRename=1r})
	 */
	public $icon;
	/**
	 * @orm has parent Article inverse images
	 */
	public $article;
	/**
	 * @orm plugin SimpleOrder(article)
	 */
	public $order;
	
	public function afterAddImage() {
		if( !$this->image->exists() ) return;
		$this->image->resize(800,600);
		$this->icon = $this->image->copy();
		$this->icon->resize(100,100,false);
		$this->icon->cut(100,100);
	}
	
}
?>